<!--
 * @Author: xiaxia
 * @Description: 
 * @Date: 2024-07-18 15:38:08
 * @LastEditTime: 2024-07-22 11:45:58
 * @FilePath: \project\src\views\screen\components\sceenTop\index.vue
-->
<template>
  <div class="screen-top">
    <div class="left">
      <span class="btnl" @click="goHmoe">首页</span>
    </div>
    <div class="center">
      <div class="title">智慧旅游可视化数据展示平台</div>
    </div>
    <div class="bottom">
      <div class="btnr">统计报告</div>
      <div class="time">当前时间: {{ nowTime }}</div>
    </div>
  </div>
</template>

<script lang="ts" setup>
import moment from 'moment';
import { onBeforeUnmount, onMounted, ref } from 'vue';
import { useRouter } from 'vue-router';
let $router = useRouter()
let timer = ref(0)
let nowTime = ref(moment().format('YYYY-MM-DD HH:mm:ss'))

onMounted(()=> {
  timer.value = setInterval(()=> {
    nowTime.value = moment().format('YYYY-MM-DD HH:mm:ss')
  }, 1000)
})
// 回到首页
const goHmoe = ()=> {
  $router.push('/home')
}

onBeforeUnmount(()=>{
  clearInterval(timer.value)
})
</script>

<style lang="scss" scoped>
.screen-top{
  width: 100%;
  height: 40px;
  display: flex;
  .left{
    flex: 1.5;
    background: url(../../images/dataScreen-header-left-bg.png) no-repeat;
    background-size: cover;
    .btnl{
      width: 150px;
      height: 40px;
      float: right;
      background: url(../../images/dataScreen-header-btn-bg-l.png) no-repeat;
      background-size: 100% 100%;
      color: #29fcff;
      text-align: center;
      line-height: 40px;
      font-size: 20px;
    } 
  }
  .center{
    flex: 2;
    .title{
      width: 100%;
      height: 74px;
      background: url(../../images/dataScreen-header-center-bg.png) no-repeat;
      background-size: 100% 100%;
      color: #29fcff;
      text-align: center;
      line-height: 74px;
      font-family: YouSheBiaoTiHei;
      font-size: 30px;
      font-weight: 600;
      letter-spacing: 4px;
    }
  }
  .bottom{
    flex: 1.5;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: url(../../images/dataScreen-header-right-bg.png) no-repeat;
    background-size: cover;
    color: #29fcff;
    .btnr{
      width: 150px;
      height: 40px;
      background: url(../../images/dataScreen-header-btn-bg-r.png) no-repeat;
      background-size: 100% 100%;
      text-align: center;
      line-height: 40px;
      font-size: 20px;
    }
    .time{
      margin-right: 10px;
    }
  }
}
</style>